<template>
  <div>
    <el-button @click="subSum(-1)">-</el-button>
    <el-input type="text" style="width: 50px" :value="num" />
    <el-button @click="subSum(1)">+</el-button>
  </div>
</template>

<script>
export default {
  name: 'Shopping',
  model: {
    prop: 'num',
    event: 'input'
  },
  props: {
    // value: {
    //   type: Number,
    //   default: 1
    // }
    num: {
      type: Number,
      default: 1
    }
  },
  methods: {
    subSum(num) {
      this.$emit('input', this.num + num)
    }
  }
}
</script>

<style></style>
